<template>
	<view class="mian">
		<scroll-view scroll-y style="height: 100%;width: 100%;"  @scrolltolower="lower" scroll-y >
		<view class="list"  v-for="(item,index) in handlingList" :key="index">
			<navigator :url="'/pages/bright/unscramble?id='+item.id">
				<view class="title">
					<text class="text1">{{item.title}}</text>
					<image class="image" src="../../static/back.png" mode=""></image>
				</view>
				<text class="text2">{{item.insertTime}}</text>
				
			</navigator>
		</view>
		<uni-load-more :status="status" v-if="handlingList.length > 0"></uni-load-more>
		</scroll-view>
	</view>
</template>

<script>
	import uniLoadMore from '@/uni-ui/libs/uni-load-more/uni-load-more.vue';
	export default{
		components: {
			uniLoadMore
		},
		data () {
			return {
				handlingList: [],
				pageNum:1,
				pageSize:10,
				status: 'more',
				loadmoreShow:true
			}
		},
		// created() {
		// 	this.getItemResult()
		// },
		onLoad() {
			this.getItemResult()
		},
		methods: {
			lower() {				
				if (this.status === 'noMore') {
					return;
				}
				this.pageNum++;
				this.getItemResult();
			},
			getItemResult(){
				uni.showLoading({
					title: '加载中',
					mask: true
				});
				this.status = 'loading';
				this.$ajax({
					url: '/api/wwwNews/getNewsList',
					method: 'GET',
					data: {
				       pageNum:this.pageNum,
					   pageSize:this.pageSize,
					   subType: 1,
					   isTop: 0
					}
				}).then(res => {
					var data = res.data.records;					
					if (data.length === 0 && this.handlingList.length === 0) {
						this.loadmoreShow = false;
						this.status = 'noMore';
					} else if (this.pageNum < res.data.pages) {
						
						this.loadmoreShow = true;
						this.status = 'more';
					} else {
						this.loadmoreShow = true;
						this.status = 'noMore';
					}
					this.handlingList = this.handlingList.concat(data);				
					
				}).finally(() => {
					uni.hideLoading();
				});
			}
		}
	}
</script>

<style scoped lang="scss">
	.list{
		margin-top: 67rpx;
		width: 690rpx;
		height: 131rpx;
		margin-left: 30rpx;
		border-bottom: 1px solid #eee;
		.title{
			display: flex;
			justify-content: center;
			align-items: center;
			.text1{
				width: 571rpx;
				height: 73rpx;
				font-family: PingFang-SC-Medium;
				font-size: 28rpx;
				font-weight: normal;
				font-stretch: normal;
				line-height: 46rpx;
				letter-spacing: 0rpx;
				color: #333333;
				display: flex;
				flex-wrap: wrap;
			}
			.image{
				margin-left: 108rpx;
				width: 10rpx;
				height: 18rpx;
			}
		}
		.text2{		
			font-size: 24rpx;		
			letter-spacing: 0rpx;
			color: #999999;
			margin-top: 17rpx;
			float: right;
		}
		
	}
</style>
